import styles from './index.module.less'
import { TeacherReport } from './TeacherReport'
import { DepartmentReport } from './DepartmentReport'
import { TrainerReport } from './TrainerReport'
import type { CommonReportData } from '../../interface'
import type { RoleType } from '../../../generate/interface'
import type { TeacherReportData } from '@/pages/report/teacher/interface'
import type { ManageType } from '@/pages/report/department/interface'

interface Props {
    type: RoleType
    data?: CommonReportData | Record<string, any>
}

export const ReportContent = (props: Props) => {
    const data = props.data

    const getName = () => {
        if (props.type === 'teacher') {
            return `${data?.name || '-'}老师`
        }
        if (props.type === 'department') {
            return data?.basic_student_module?.region || '-'
        }
        return data?.name || '-'
    }
    return (
        <div className={styles.container}>
            <div className={styles.topSign} />

            <div className={styles.whoami}>
                <div className={styles.left_sign} />
                <p>{getName()}</p>
                <div className={styles.right_sign} />
            </div>

            <p className={styles.keyword_hint}>2024年度关键词</p>

            <p className={styles.keyword}>{data?.key_word ?? ''}</p>

            {props.type === 'teacher' && <TeacherReport data={props.data as TeacherReportData} />}

            {props.type === 'department' && <DepartmentReport data={props.data as ManageType} />}

            {props.type === 'trainer' && <TrainerReport data={props.data as ManageType} />}

            <div className={styles.bottomSign} />
        </div>
    )
}
